﻿
// AssemblyDemonstrationView.h: CAssemblyDemonstrationView 类的接口
//

#pragma once
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "GL/glew.h"
#include "OpenGL/VertexBuffer.h"
#include "OpenGL/VertexArray.h"
#include "OpenGL/ModelLoader.h"
#include "OpenGL/ADProgram.h"
#include "OpenGL/Camera.h"

class CAssemblyDemonstrationView : public CView
{
private:
	HGLRC m_hRC;     // Rendering Context
	HDC m_hDC;       // Device Context

	unsigned int m_iVAO, m_iVBO;
	int Width, Height;
	//float x;
	void EnableAntialias();
	bool inited;

	// camera
	Camera m_Camera;
	ModelLoader *m_Model;
	ADProgram *m_Program;
    int m_LastX;
    int m_LastY;
    bool m_MouseMiddlePressed = false;
    float z = 10;
    int num = 0;
    float m_FallingSpeed = 0.1;
    bool m_IsPause = false;

protected: // 仅从序列化创建
	CAssemblyDemonstrationView() noexcept;
	DECLARE_DYNCREATE(CAssemblyDemonstrationView)

// 特性
public:
	CAssemblyDemonstrationDoc* GetDocument() const;

// 操作
public:

// 重写
public:
	virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:

// 实现
public:
	virtual ~CAssemblyDemonstrationView();
#ifdef _DEBUG
#endif

public:
	void Setup();
	void InitGL();

// 生成的消息映射函数
protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnDestroy();
    afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
    virtual BOOL PreTranslateMessage(MSG* pMsg);
    afx_msg void OnTimer(UINT_PTR nIDEvent);
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
};

#ifndef _DEBUG  // AssemblyDemonstrationView.cpp 中的调试版本
inline CAssemblyDemonstrationDoc* CAssemblyDemonstrationView::GetDocument() const
   { return reinterpret_cast<CAssemblyDemonstrationDoc*>(m_pDocument); }
#endif

